﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xyz.BusinessObjects;

using Xyz.DataObjects.Interfaces;

namespace Xyz.DataObjects.Entity.Dao
{
    public class EntityCountryDao : ICountryDao
    {
        public List<Country> GetAllCountries()
        {
            using (var context = EntityObjectFactory.CreateContext())
            {
                var countries = new List<Country>();
                var query = context.CountryEntities.OrderBy(c => c.CountryName).ToList();

                query.ForEach(x => countries.Add(Mapper.Map(x)));

                return countries;
            }
        }
    }
}
